package com.tanhua.model.vo;

import com.tanhua.model.mongo.Option;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;

/**
 * 返回选项vo类
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class OptionVo implements Serializable {
    private String id;  //选项编号
    private String questionId; //试题编号
    private String option;      //选项
    private Double score;   //得分

    public static OptionVo init(Option option) {
        OptionVo vo = new OptionVo();
        BeanUtils.copyProperties(option, vo);
        vo.setId(option.getId().toHexString());
        vo.setQuestionId(option.getQuestionId().toHexString());
        return vo;
    }
}
